package com.sxj.corejava.code07_面向对象.封装;

/**
 * @author 石小俊
 * @date 2025年01月06日
 */
public class Employee {

    private String name;
    private double salary;
    private String gender;
    private int age;

    public Employee(String name, double salary, String gender, int age) {
        this.name = name;
        this.salary = salary;
        this.gender = gender;
        this.age = age;
    }

    public void show() {
        if (age < 18) {
            age = 18;
        }
        System.out.println("name:" + name + ",salary:" + salary + ",gender:" + gender + ",age:" + age);
    }

    public void work() {
        System.out.println(name + "的工资是:" + salary + "元");
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public double getSalary() {
        return salary;
    }

    public String getGender() {
        return gender;
    }

    public int getAge() {
        return age;
    }

}
